package 强化训练;

import java.util.*;

public class 去重公共子串 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            String str1 = sc.nextLine();
            String str2 = sc.nextLine();
            Set<String> set = new HashSet<>();
            for(int i = 0;i < str2.length();i++){
                if(!set.contains(str2.substring(i,i+1))){
                    set.add(str2.substring(i,i+1));
                }
            }
            StringBuilder sb = new StringBuilder();
            for(int i = 0;i < str1.length();i++){
                if(!set.contains(str1.substring(i,i+1))){
                    sb.append(str1.substring(i,i+1));
                }
            }
            System.out.println(sb.toString());
        }
    }
}
